package com.xm9m.ibczy.dsp.https;

import android.content.Context;

import com.xm9m.ibczy.dsp.beans.RTBRequestBean;
import com.xm9m.ibczy.dsp.utils.NetWorkUtils;

import java.util.Random;

/**
 * Created by baichuan on 2016/11/18.
 */

public class RTBRequestFatory {


    public static RTBRequestBean.RTBRequest getRequest(Context context) {
        //请求体
        RTBRequestBean.RTBRequest request = RTBRequestBean.RTBRequest.newBuilder()
                .setSid("1123123123")
                .setClientIp(NetWorkUtils.getIpString(NetWorkUtils.getIp(context)))
                .setNetType(RTBRequestBean.RTBRequest.NetType.NT_Wifi)
                .setOs("android")
                .setIdInfo(RTBRequestBean.RTBRequest.IdInfo.newBuilder()
                        .setImei("865372022028358")
                        .setMac(NetWorkUtils.getMac(context))
                        .setAndroidId("sdfskdjfskj234234")
                )
                .addAdSlots(RTBRequestBean.RTBRequest.AdSlotInfo.newBuilder()
                        .setId("10103")
                        .setWidth(440)
                        .setHeight(220)
                        .setOpenScreen(false)
                        .setMinCpm(0)
                        .setReqNum(10)
                        .setAdSlotType(RTBRequestBean.RTBRequest.AdSlotInfo.AdSlotType.AST_FEEDS)
                        .setPageIndex(new Random().nextInt(20) + 1)
                        .build())
                .setOs("android")
                .build();
        return request;
    }
}
